﻿using System.Collections.Generic;
using System.Linq;
using ZBJF.Warranty.Common.Common;
using ZBJF.Warranty.Common.Enums.InsuranceProducts;
using ZBJF.Warranty.Model;

namespace ZBJF.Warranty.BLL
{
    public partial class InsuranceProductOrderAuditMappingsSnapshootService
    {
        /// <summary>
        /// 产品订单的产品审核配置快照（保险产品非保险卡）
        /// </summary>
        /// <param name="insuranceProductOrderID">销售订单ID</param>
        /// <param name="insuranceProductOrderNo">订单号</param>
        /// <param name="sellerInsuranceProductId">商家保险产品</param>
        /// <returns></returns>
        public bool CreateSnapshoot(long sellerInsuranceProductId, long insuranceProductOrderID, string insuranceProductOrderNo)
        {
            //var insuranceProductIDs = ServiceFactory.SellerInsuranceProductMappingsServiceInstance.GetAllInsuranceProductIDs(sellerInsuranceProductId);
            //if (insuranceProductIDs.Any())
            //{
            //    for (int j = 0; j < insuranceProductIDs.Count; j++)
            //    {
            //        var insuranceProductID = insuranceProductIDs[j];
            //        var result = false;
            //        var insuranceProductOrderAuditMappings =
            //            ServiceFactory.InsuranceProductsAuditMappingsServiceInstance.LoadByInsuranceProductID(insuranceProductID).ToList();
            //        if (insuranceProductOrderAuditMappings.Any())
            //        {
            //            for (int i = 0; i < insuranceProductOrderAuditMappings.Count; i++)
            //            {
            //                var entity = new InsuranceProductOrderAuditMappingsSnapshoot
            //                {
            //                    InsuranceProductOrderID = insuranceProductOrderID,
            //                    InsuranceProductOrderNo = insuranceProductOrderNo,
            //                    InsuranceProductID = insuranceProductID,
            //                };
            //                var item = insuranceProductOrderAuditMappings[i];
            //                entity.AuditConfigTypeName = EnumHelper.Instance.GetDescription(typeof(AuditConfigType), item.AuditConfigTypeProjectMappings.AuditConfigType);
            //                entity.AuditProjectCategoryName =
            //                    item.AuditConfigTypeProjectMappings.InsuranceProductsAuditProject
            //                        .InsuranceProductsAuditProjectCategory.ProjectCategoryName;
            //                entity.AuditProjectName =
            //                    item.AuditConfigTypeProjectMappings.InsuranceProductsAuditProject.ProjectName;
            //                result = AddEntities(entity).ID > 0;
            //            }
            //            return result;
            //        }
            //    }
            //}
            return true;
        }
    }
}